/*
	Project:FFmpeg Media Source for Windows Media Foundation
	Part:Common
	File:WinRTHStringRef.h

	Creator:ShanYe (2014-06-13)
	Last Change:ShanYe (2014-06-13)
	Rev:1.0.0
*/

#pragma once

#include "stdafx.h"
#include <winstring.h>

class HStrRef
{
	HSTRING_HEADER head;
	HSTRING hstr = NULL;
	HRESULT hr;
public:
	HStrRef(PCWSTR pstr)
	{
		hr = WindowsCreateStringReference(pstr,wcslen(pstr),&head,&hstr);
	}
	~HStrRef()
	{
		if (hstr)
			WindowsDeleteString(hstr);
	}
public:
	HSTRING Get()
	{
		return hstr;
	}
};